<template>
  <van-tabs v-model="active">
    <van-tab v-for="subWidget in widget.childWidgetList" :key="subWidget.variableName"
        :title="subWidget.showName" :name="subWidget.variableName"
    >
      <online-custom-block :widgetList="subWidget.childWidgetList" />
    </van-tab>
  </van-tabs>
</template>

<script>
export default {
  name: 'onlineCustomTabs',
  props: {
    widget: {
      type: Object
    }
  },
  data () {
    return {
      active: undefined
    }
  },
  computed: {

  },
  watch: {
    'widget.childWidgetList': {
      handler () {
        if (this.widget == null || !Array.isArray(this.widget.childWidgetList)) {
          this.active = undefined;
        } else {
          this.active = (this.widget.childWidgetList[0] || {}).variableName;
        }
      },
      immediate: true
    }
  }
}
</script>

<style>
</style>
